package com.zs.service;

import com.zs.bean.SystemUser;
import com.zs.respository.SystemUserRepository;
import com.zs.util.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Description:
 *
 * @author: zsq-1186
 * Date: 2017-12-04-15:04
 */

@Service
public class SystemUserService {

    private Logger logger= LoggerFactory.getLogger(this.getClass());

    @Autowired
    private SystemUserRepository systemUserRepository;


    /**
     * 创建临时用户
     * @param email 用户邮箱
     * @return 临时用户的密码
     */
    public String autoCreateTempSystemUser(String email){
        String password= Util.getCode();
        String md5Password=Util.getMD5(password);
        SystemUser systemUser=new SystemUser(email,email,null,md5Password);
        systemUserRepository.insert(systemUser);
        return password;
    }


}
